package com.chinasofti.tcp;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        //创建服务端socke
        ServerSocket ss = new ServerSocket(10000);
        //侦听要链接到此套接字的信息
        Socket s =ss.accept();
        //获取数据流，读取数据
        InputStream is = s.getInputStream();

        byte [] bys = new byte[1024];
        int length = is.read(bys);
        String data = new String(bys,0,length);
        System.out.println("数据是"+ data);
        s.close();
        ss.close();
    }
}
